package com.tjx.controller;


import com.tjx.common.Result;
import com.tjx.entity.AmusementProject;
import com.tjx.entity.Employee;
import com.tjx.mapper.AmusementProjectMapper;
import com.tjx.service.IAmusementProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 游乐项目表 前端控制器
 * </p>
 *
 * @author tjx
 * @since 2025-10-29
 */
@RestController
@RequestMapping("/amusement-project")
public class AmusementProjectController {
    @Autowired
    private IAmusementProjectService amusementProjectService;

    /**
     * 查询所有游乐项目
     */
    @RequestMapping("/amusementProjectQueryAll")
    public Result<List<AmusementProject>> amusementProjectQueryAll() {
        List<AmusementProject> amusementProjectList = amusementProjectService.amusementProjectQueryAll();
        if (amusementProjectList == null) {
            return Result.fail();
        }
        return Result.ok(amusementProjectList);
    }

    /**
     * 修改游乐项目
     */
    @RequestMapping("/amusementProjectUpdate")
    public Result<AmusementProject> amusementProjectUpdate(@RequestBody AmusementProject amusementProject) {
        Integer row = amusementProjectService.amusementProjectUpdate(amusementProject);
        if (row == 0) {
            return Result.fail();
        }
        return Result.ok();
    }
}
